<%@ page language="java"  pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>上报位置</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=fGBn2V7Y7AdDUxK54hbqX1MC"></script>
  </head>
  
  <body onload = "initMap(<%=request.getParameter("lng")%>,<%=request.getParameter("lat")%>)" >
    <div id="iCenter" style = "width:100%;height:100%"  ></div>
  </body>
  <script type="text/javascript">
  
  var map =   null;          // 创建Map实例
	function initMap(lat,lng){
	   var height = window.screen.availHeight;
	   var width = window.screen.availWidth;
	  
	// 百度地图API功能
		 map =new BMap.Map("iCenter");
		map.enableScrollWheelZoom(true);
		map.addControl(new BMap.NavigationControl());  //添加默认缩放平移控件
		map.addControl(new BMap.NavigationControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT, type: BMAP_NAVIGATION_CONTROL_PAN}));  //左下角，仅包含平移按钮
		map.addControl(new BMap.NavigationControl({anchor: BMAP_ANCHOR_BOTTOM_RIGHT, type: BMAP_NAVIGATION_CONTROL_ZOOM}));  //右下角，仅包含缩放按钮
		                     // 初始化地图,设置中心点坐标和地图级别。
		if(lat&&lng){
		map.centerAndZoom(new BMap.Point(<%=request.getParameter("lng")%>,<%=request.getParameter("lat")%>),12);
		}else {
		map.centerAndZoom("北京",12);
		}
		map.addControl(new BMap.MapTypeControl());          //添加地图类型控件
		var point = new BMap.Point(<%=request.getParameter("lng")%>,<%=request.getParameter("lat")%>);
		addMarker(point);
	}
	
	function addMarker(point,address){
	  var marker = new BMap.Marker(point);
	  map.addOverlay(marker);
	 // var infoWindow2 = new BMap.InfoWindow("<p style='font-size:14px;'>"+address+"</p>");
	 //	marker.addEventListener("click", function(){this.openInfoWindow(infoWindow2);});
	}

  </script>
</html>
